﻿using System;
using System.Web;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Collections;

using com.fly.sms;

namespace com.fly.sms
{
    public class LoginAction : IAction
    {
        protected Hashtable ht = new Hashtable();
        protected HttpContext context;
        public LoginAction(HttpContext contextTemp)
        {
            this.context = contextTemp;
        }
        public void process() {
            string LoginName = context.Request["LoginName"];
            string LoginPass = context.Request["LoginPass"];
            string CheckCode = context.Request["CheckCode"];
            bool flag = CustomerService.login(LoginName, LoginPass);
            ht.Add("responseCode", "200");
            Hashtable ht2 = new Hashtable();
            ht2.Add("loginstate", flag);
            if (flag)
            {
                ht2.Add("sessionkey", "sdfwoerwdfwGSldsfmslsldfsFYsdFEMGsK");
            }
            ht.Add("responseData", ht2);
            string json = JsonConvert.SerializeObject(ht);
            context.Response.Write(json);
        }
    }
}